<!DOCTYPE html>
<html lang="zh-CN">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <title>Document</title>
</head>

<body>
  <script>
    /* 
      查找规则:
        1.先在__proto__里面查找
        2.后再prototype原型对象查找
     */
    const Star = function (uname, age) {
      this.uname = uname;
      this.age = age;
    };
    Star.prototype.sing = function () {
      console.log(`这是一个很好的方法`);
    };
    let ldh = new Star("中国", 20);
    console.log(ldh); //系统会自动添加__proto__这个方法,它指向我们构造函数的prototype对象
    console.log(ldh.__proto__ === Star.prototype); //这两个是相等的
  </script>
</body>

</html>